(function(w){	
	
	var geoc = new BMap.Geolocation();
	var geol = new BMap.Geocoder();
	
	geoc.getCurrentPosition(function(r){
		if(this.getStatus() == BMAP_STATUS_SUCCESS){
			
			geol.getLocation(r.point,function(rs){
				var comp = rs.addressComponents ;
				$('#location').text(comp.city);
				w.setLocalCity(comp.city) ;
			}) ;
		}
		else {
			$("#location").text('获取地址失败') ;
		}        
	},{enableHighAccuracy: true})
	
	$('.idx-cc-a').on('click',function(){
		w.setCity($(this).html()) ;
		w.location.href = '/index.html' ;
	});
	$('#location').on('click',function(){
		w.setCity(w.getLocalCity()); 
		w.location.href = '/index.html' ;
	}) ;
	
}(window));